using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DisplayCurrentDate();
            DisplayWillBeDoneFloors();
            DisplayMostBidFloors();

            DisplayAds();
        }
    }

    private void DisplayMostBidFloors()
    {
        DataTable dtMostBid = new FloorBus().LoadMostBidFloors(DateTime.Now);
        if (dtMostBid.Rows.Count == 0) lblMostBidRs.Visible = true;
        else
        {
            lblMostBidRs.Visible = false;
            dlMostBidRs.DataSource = dtMostBid;
            dlMostBidRs.DataBind();
        }
    }

    private void DisplayWillBeDoneFloors()
    {
        DataTable dtDone = new FloorBus().LoadWillBeDoneFloors(DateTime.Now);
        if (dtDone.Rows.Count == 0) lblDoneRs.Visible = true;
        else
        {
            lblDoneRs.Visible = false;
            dlDone.DataSource = dtDone;
            dlDone.DataBind();
        }
    }

    private void DisplayCurrentDate()
    {
        string curDate = string.Format("{0:d}", DateTime.Today);
        lblCurDate.Text = curDate;
        lblCurDate2.Text = curDate;
    }

    private void DisplayAds()
    {
        DataTable dtAds = new AdBus().LoadAds();
        dlAds.DataSource = dtAds;
        dlAds.DataBind();
    }
}
